#include <iostream>
#include <unordered_map>

using namespace std;

unordered_map<string, int> mp;

int main()
{
	int n; cin >> n;

	int op;
	string name;
	while(n--)
	{
		cin >> op;
		if(op == 4)// 汇总
		{
			cout << mp.size() << endl;
			continue;
		}

		cin >> name;
		if(op == 1) // 插入/修改
		{
			int score; cin >> score;
			mp[name] = score;
			cout << "OK" << endl;
		}
		else if(op == 2)// 查询
		{
			if(mp.count(name)) cout << mp[name] << endl;
			else cout << "Not found" << endl;
		}
		else if(op == 3) // 删除
		{
			if(mp.count(name))
			{
				mp.erase(name);
				cout << "Deleted successfully" << endl;
			}
			else cout << "Not found" << endl;
		}
	}

	return 0;
}